package cn.edu.dz.test;

import java.io.Serializable;
//实现  接口，表示该类可被序列化
// 序列化准备工作：1、需要有setter 、getter方法；2、需要与无参构造;3;实现接口
public class Student implements Serializable {
   //显示的显现  序列化版本号，显示声明，不生命可能会导致反序列化的时候发生异常
    static final  long serialVersionUID=1l;
    //加上transient关键字，该属性不会序列化，读取不到
    private  transient int stuNo;
    private  String stuName;
    //private int stuNo;
    private  boolean sex;

    public  Student(){}

    public Student(String stuName, int stuNo, boolean sex) {
        this.stuName = stuName;
        this.stuNo = stuNo;
        this.sex = sex;
    }

    public String getStuName() {
        return stuName;
    }

    public void setStuName(String stuName) {
        this.stuName = stuName;
    }

    public int getStuNo() {
        return stuNo;
    }

    public void setStuNo(int stuNo) {
        this.stuNo = stuNo;
    }

    public boolean isSex() {
        return sex;
    }

    public void setSex(boolean sex) {
        this.sex = sex;
    }

    @Override
    public String toString() {
        return "Student{" +
                "stuName='" + stuName + '\'' +
                ", stuNo=" + stuNo +
                ", sex=" + sex +
                '}';
    }
}
